<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <div id="contentmid">
	    <s:if test="#session.loggedUser != null && #session.loggedUser.amministratore == true">
	        <div class="midheading">
	            <h2>Gestione categorie</h2>
	        </div>
	        <div class="midtxt">
	        Aggiungi una nuova categoria principale al catalogo
	        <table>
	        <s:form action="nuova_categoria">
	            <s:textfield name="newCatName" label="Nome categoria"/>
	            <s:submit value="Crea"/>            
	        </s:form> 
	        </table>    
	        </div>
	        <div class="midheading">
	            <h2>Elenco categorie</h2>
	        </div>
	        <div class="midtxt">
	        <table>
	            <tr>
	                <th>Categoria</th>
		            <th>Operazioni</th>
	            </tr>            
	            <s:iterator value="#session.categorie">
	                <tr>
	                    <s:form theme="simple" action="modifica_categoria">
	                    <td><s:property value="nome"/></td>
	                    <s:hidden name="modCategoria" value="%{idCategoria}"/>
	                    <td><s:submit value="Modifica" /></td>
	                    </s:form>
	                </tr>              
	            </s:iterator>
	        </table>
	        </div>
	        <form>
	           <input type="button" value="Indietro" onClick="javascript:history.back()" name="button">
	        </form>
	    </s:if>
	    <s:else>
	        <h3><s:text name="message.notlogged"/></h3>
	    </s:else>
    </div>